package com.example.android60permission;

import com.chad.library.adapter.base.BaseMultiItemQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;

import java.util.List;

/**
 * Created by Administrator on 2017/5/27.
 */

public class BaseMultiAdapter extends BaseMultiItemQuickAdapter<TestBean,BaseViewHolder> {

    /**
     * Same as QuickAdapter#QuickAdapter(Context,int) but with
     * some initialization data.
     *
     * @param data A new list is created out of this one to avoid mutable list
     */
    public BaseMultiAdapter(List<TestBean> data) {
        super(data);
        addItemType(0,R.layout.item_one);
        addItemType(1,R.layout.item_two);
    }

    @Override
    protected void convert(BaseViewHolder helper, TestBean item) {
        switch (helper.getItemViewType()){
            case 0:
                helper.setText(R.id.text_one,"haha"+"\n"+item.getName()+"\n"+item.getDesc());
                break;

            case 1:
                helper.setText(R.id.text_two,"666"+"\n"+item.getName()+"\n"+item.getDesc());
                break;
        }
    }
}
